package com.xbongbong.saas.model.impl;

import com.xbongbong.paas.toolbox.util.DateUtil;
import com.xbongbong.pro.domain.dao.StageProcessRetainDao;
import com.xbongbong.pro.domain.entity.StageProcessRetainEntity;
import com.xbongbong.saas.model.StageProcessRetainModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author bomfish
 */
@Service("stageProcessRetainModel")
public class StageProcessRetainModelImpl implements StageProcessRetainModel {
    @Resource
    private StageProcessRetainDao stageProcessRetainDao;

    @Override
    public Integer insert(StageProcessRetainEntity entity) {
        Long time = DateUtil.getNow();
        entity.setAddTime(time);
        entity.setUpdateTime(time);
        return stageProcessRetainDao.insert(entity);
    }

    @Override
    public void insertBatch(List<StageProcessRetainEntity> list) {
        stageProcessRetainDao.insertBatch(list);
    }

    @Override
    public List<StageProcessRetainEntity> findEntitys(Map<String, Object> param) {
        return stageProcessRetainDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return stageProcessRetainDao.getEntitysCount(param);
    }

    @Override
    public Integer update(StageProcessRetainEntity entity) {
        Long time = DateUtil.getNow();
        entity.setUpdateTime(time);
        return stageProcessRetainDao.update(entity);
    }

    @Override
    public StageProcessRetainEntity getByKey(Long key, String corpid) {
        return stageProcessRetainDao.getByKey(key, corpid);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return stageProcessRetainDao.findEntitys(param);
    }
}
